package com.inray.nbs.push;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

import nl.justobjects.pushlet.core.Event;
import nl.justobjects.pushlet.core.EventPullSource;
@SuppressWarnings("serial")
public class NoticePush extends EventPullSource implements Serializable{
	private static Event event = Event.createDataEvent("noticepush");
	private static int isSee=1;
	/**
     * 设置休眠时间
     */
	@Override
	protected long getSleepTime() {
		// TODO Auto-generated method stub
		return 1000;
	}
	/**
     * 创建事件
     * 
     * 业务部分写在pullEvent()方法中，这个方法会被定时调用。
     */
	@Override
	protected Event pullEvent() {
		if(isSee==1){
			event = Event.createDataEvent("noticepush");
			event.setField("notice", "not");
		}else{
			isSee=1;
		}
		return event;
	}
	public static void SetStr(String ss) throws UnsupportedEncodingException{
		event = Event.createDataEvent("noticepush");
		event.setField("notice", new String(ss.getBytes("UTF-8"), "ISO-8859-1"));
		isSee=0;
	}
}
